package com.test08_面向对象应用;

public class YootkDemo_03 {

    public static void main(String[] args) {
        get(new Manager("小李", 20, '男', "部门经理", 60000));
        get(new Staff("小张", 19, '女', "后勤部", 90000));
    }

    public static void get(Employee emp) {
        System.out.println(emp);
    }
}

/**
 * 员工类
 */
class Employee {
    private String name;
    private int age;
    private char sex;

    public Employee() {
    }

    public Employee(String name, int age, char sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;
    }

    @Override
    public String toString() {
        return "姓名：" + this.name + "、年龄：" + this.age + "、性别：" + this.sex;
    }
}

/**
 * 管理层类
 */
class Manager extends Employee {
    private String job;
    private double income;

    public Manager() {
    }

    public Manager(String name, int age, char sex, String job, double income) {
        super(name, age, sex);
        this.job = job;
        this.income = income;
    }

    @Override
    public String toString() {
        return super.toString() + "、职位：" + this.job + "、年薪：" + this.income;
    }
}

/**
 * 职员类
 */
class Staff extends Employee {
    private String dept;
    private double salary;

    public Staff() {
    }

    public Staff(String name, int age, char sex, String dept, double salary) {
        super(name, age, sex);
        this.dept = dept;
        this.salary = salary;
    }

    @Override
    public String toString() {
        return super.toString() + "、部门：" + this.dept + "、月薪：" + this.salary;
    }
}
